package com.ipt.frm.comprobacion;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class ComprobarDispositivo
 */
public class ComprobarDispositivo extends HttpServlet {
	private static final long serialVersionUID = -8740517983445445007L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	@Override
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		// System.out.println(request.getHeader("user-agent").toString());

		boolean comprobar = (request.getHeader("user-agent").toLowerCase()
				.contains("mobile"));

		if (comprobar) {
			request.getRequestDispatcher("/movil/login.jsp").forward(request,
					response);
		} else {
			request.getRequestDispatcher("login.jsp")
					.forward(request, response);
			;
		}
	}

}
